package com.han.memento.white_box;

/**
 * @ClassName Client
 * @Description 描述该类的功能
 * @Author duoduo Han
 * @Date 2024/6/22 11:34
 */
public class Client {
    public static void main(String[] args) {
        System.out.println("----------------大战boss前-----------------");
        //创建游戏角色对象
        Player player = new Player();
        player.initState();//初始状态操作
        player.showState();
        //将该游戏角色状态进行备份
        //创建管理者对象
        PlayerStateCaretaker playerStateCaretaker = new PlayerStateCaretaker();
        playerStateCaretaker.setMemento(player.saveState());
        System.out.println("----------------大战boss后-----------------");
        //损耗严重
        player.fight();
        player.showState();
        System.out.println("==================恢复之前状态=======================");
        player.recoveryState(playerStateCaretaker.getMemento());
        player.showState();
    }
}
